﻿using System.Collections.Generic;
using IHodelBll;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Model;

namespace HotelUI.Controllers
{
    /// <summary>
    /// 人事管理
    /// </summary>
    public class PersonnelController : Controller
    {
        //Ioc
        private readonly ILogger<PersonnelController> _logger;
        IPersonnelBll _IPersonnel;
        /// <summary>
        /// 依赖注入
        /// </summary>
        /// <param name="logger"></param>
        /// <param name="personnelBll"></param>
        public PersonnelController(ILogger<PersonnelController> logger, IPersonnelBll personnelBll)
        {
            _logger = logger;
            _IPersonnel = personnelBll;
        }
        


        public IActionResult HomeIndex()
        {
            return View();
        }
        public IActionResult Addsf()
        {
            return View();
        }
        public int Add(Staffs s)
        {
            return _IPersonnel.AddStaff(s);
        }
        public int DelSt(int id)
        {
            return _IPersonnel.DelStaff(id);
        }
        public List<Staffs> GetStaffs()
        {
            var list = _IPersonnel.Show();
            return list;
        }
        /// <summary>
        /// 职位管理页面
        /// </summary>
        /// <returns></returns>
        public IActionResult Positions()
        {      

            return View();
        }
       
        
        /// <summary>
        /// 部门管理
        /// </summary>
        /// <returns></returns>
        public IActionResult Departments()
        {
            return View();
        }
        /// <summary>
        /// 部门列表显示
        /// </summary>
        /// <returns></returns>
        public List<Departments> Departmentshow()
        {
            var list = _IPersonnel.DepartmentList();
            return list;
        }
        [HttpPost]
        public int AddDpm(Departments s)
        {
            var res=_IPersonnel.AddDpm(s);
            return res;
        }
        [HttpPost]
        public int Addps(Positions s)
        {
            var res = _IPersonnel.Addps(s);
            return res;
        }
        /// <summary>
        /// 职位列表显示
        /// </summary>
        /// <returns></returns>
        public List<Positions> Positionshow(int id)
        {
            List<Positions> list = _IPersonnel.PositionList(id);
            return list;
        }
    }
}
